package com.qf.artical.controller;

import com.qf.artical.pojo.User;
import com.qf.artical.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author
 */
@RestController
@RequestMapping("/users")
public class UserController {

    private UserService userService;

    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }


    @PostMapping("/users")
    public void AddUser(@RequestBody User user){

         userService.AddUser(user);
    }

    @GetMapping("/user")
    public User findUserByName( String name){

        return userService.findUserByName(name);
    }

}
